/*
 * Copyright 2017 The Kubernetes Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

@import '../../scss/components/StatusStripe/mixins';

body.subwindow .kui--sidecar .sidecar-bottom-stripe-close {
  /* no close button if in subwindow/popup mode */
  display: none;
}
body.subwindow.sidecar-full-screen .sidecar-bottom-stripe-maximize:not(.screenshot-button) {
  /* in subwindow mode, no maximize or unmaximize buttons */
  display: none;
}
/*body.subwindow .kui--sidecar .activation-result .log-line .log-field code {
    background: var(--color-ui-02);
}*/
body.subwindow .kui--sidecar .log-lines .log-line:nth-child(2n + 1) .log-field {
  background: var(--color-ui-02);
}
body.subwindow .kui--sidecar {
  border-left: none;
  box-shadow: none;
}
body.subwindow[data-presentation='FixedSize'] .kui--sidecar .sidecar-header {
  border-bottom-color: var(--color-base01);
}
body.subwindow .kui--sidecar .sidecar-header .sidecar-header-text.is-repl-like .entity-name {
  display: none;
}
body.subwindow .kui--sidecar .sidecar-header-text.is-repl-like .repl-input {
  display: flex;
}
body.subwindow .kui--sidecar .sidecar-header-name-content,
body.subwindow .kui--sidecar .sidecar-header-text,
body.subwindow .kui--sidecar .sidecar-header-text.is-repl-like .repl-input {
  /* make sidecar-header-input occupy full width */
  flex: 1;
}
body.subwindow .kui--sidecar .padding-content .padding-content {
  /* this rule protects against nested padding-content; we don't want to pad twice */
  padding: 0;
}
body.subwindow[data-presentation='FixedSize'] .kui--sidecar .padding-content {
  /* content takes care of layout, e.g. monaco-editor */
  padding: 0;
}
body.subwindow .kui--sidecar .padding-content {
  overflow: auto;
}
body.subwindow .kui--sidecar .sidecar-header-secondary-content {
  font-size: 1em;
}
/* Duplicate rule with line 1451 in ui.css */
body.subwindow .kui--sidecar .repl-input,
body.subwindow .kui--sidecar .repl-block .ok-line:not(.show-in-popup) .ok {
  display: none;
}
body.subwindow .kui--sidecar .usage-error-wrapper .page-content {
  display: flex;
  flex-direction: column;
}
body.subwindow .kui--sidecar .repl-input input {
  -webkit-app-region: no-drag;
  font-family: var(--font-sans-serif);
  font-size: unset;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subwindow .kui--sidecar .sidecar-header .header-right-bits .activation-viz-plugin.grid-header-key table {
  border-spacing: 0;
}
body.subwindow .kui--sidecar.entity-is-actions:not(.entity-is-sequence) .action-source,
.kui--sidecar .activation-result {
  padding: inherit;
}
body.subwindow .sidecar-full-screen .kui--sidecar .sidecar-header .entity-name-line {
  flex-wrap: wrap;
}
body.subwindow .sidecar-full-screen .kui--sidecar .sidecar-header .action-content #version {
  min-height: 20px;
}

/*
 if we want to hide the close button in the sidecar bottom stripe when in sidecar-full-screen mode
body.subwindow .sidecar-full-screen sidecar:not(.minimized) .sidecar-bottom-stripe .sidecar-bottom-stripe-close {
    display: none;
}*/

.repl:not(.kui--input-stripe) {
  padding-top: 0;
  .repl-block {
    margin: 0.5em 2px 2px 2px;

    .repl-prompt {
      margin-right: 0.1875em;
      .repl-context {
        /* e.g. cwd displayed in prompt */
        /* display: none; */
      }
    }
  }
}

/* input stripe in status stripe */
body.subwindow {
  .repl-block:not(.repl-active) {
    .repl-prompt-righty {
      color: var(--color-text-02);
    }
  }

  .kui--status-stripe {
    .kui--input-stripe {
      padding: 0;
      background-color: transparent;
      box-shadow: none;

      /* 2em plus 0.5em padding top and bottom for the kui--input-and-cojntext */
      flex-basis: 2.1em;

      .repl-block .repl-input {
        white-space: nowrap;
        flex-wrap: nowrap;
        &,
        .kui--input-and-context {
          background-color: transparent;
        }

        input::placeholder {
          color: var(--color-text-02);
          opacity: 0.75;
        }
      }
    }

    @include StatusStripeElement {
      border-left: $element-border;
      padding: 0 1em;
      &:last-child {
        border-right: none;
      }
    }

    @include StatusStripeButton {
      border-left: none;
    }

    .kui--status-stripe-context {
      &:not(.kui--input-stripe-in-status-stripe) {
        flex: initial;
      }

      .kui--input-stripe {
        font-size: 0.875rem; /* rem needed, because status stripe has a font-size em */
        flex: 1;

        .repl-block .repl-input .kui--input-and-context {
          font-size: 1em;
        }
      }
    }
  }
}
